home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / T-Z / Windoids.cpt / Windoid 1.6.1 / card_13344.txt < prev    next >
Text File  |  1989-04-13  |  2KB  |  64 lines

  1. -- card: 13344 from stack: in.1
  2. -- bmap block id: 13596
  3. -- flags: 0000
  4. -- background id: 10029
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 11
  9. ----- text -----
  10. ‚Ä¢ WINDOID is great!  It has been a big help to see those example scripts and learn new features and tricks. Especially things that are not shown in Goodman's book (Ed: Danny Goodman - The Complete HyperCard Handbook - Bantam) or other places.  Since I've learned so much from WINDOID, I'd like to share a script with the other readers.
  11.  
  12. How can you get several scrollable fields to all scroll together?
  13.  
  14. Put these two handlers in your card script.
  15.  
  16. On openCard
  17.   global initScroll
  18.   put 0 into initScroll
  19.   repeat with i = 2 to 5
  20.     set the scroll of card field i to initScroll
  21.   end repeat
  22. end openCard
  23.  
  24. The script above simply sets all the scrollable fields you want (in this case fields 2 thru 5) to zero - elevator at the top of the scroll bar.  It also stores that scroll value (zero) in a global variable (initScroll).
  25.  
  26. on updateScroll
  27.   global initScroll
  28.   repeat with i = 2 to 5
  29.     set the scroll of card field i to initScroll
  30.   end repeat
  31. end updateScroll
  32.  
  33. This is the workhorse script. It sets the scroll of the fields you want, all equal to the variable initScroll. initScroll gets changed by the user scrolling one of the fields. That's what the next script does.
  34.  
  35. Put the following script in each of the scrollable fields.
  36.  
  37. on mouseWithin
  38.   global initScroll
  39.   if the scroll of me <> initScroll then
  40.     get the scroll of me
  41.     put it into initScroll
  42.     updateScroll
  43.   end if
  44. end mouseWithin
  45.  
  46. The above script detects changes in a field's scroll bar and changes the value of the global variable initScroll.  Then it calls the updateScroll script (on the card) to change all appropriate fields to the same value.
  47.  
  48. These scripts are great for creating tabular style fields that can scroll and yet keep all the info lined up between fields.  It helps to lay out the fields so that their tops and bottoms are even.
  49. •
  50.  
  51. -- part contents for background part 17
  52. ----- text -----
  53. Scrolling
  54. Multiple
  55. Fields
  56.  
  57. -- part contents for background part 18
  58. ----- text -----
  59. ‚Ä¢ by
  60. Bill Champ
  61.  
  62. -- part contents for background part 19
  63. ----- text -----
  64. volume 1 ‚Ä¢  number  6  ‚Ä¢  card 9  ‚Ä¢